<?php
namespace app\index\controller;
use think\Db;
use think\Lang;
use think\Config;
class Search{
    public function index(){
       rjson(Lang::get('SUCCESS_DONE'),1,Db::name('search')->where('status=1')->field('name,id')->select());
    }
	
	function add_view(){
		if(empty($_POST['id']) || (int)$_POST['id'] != $_POST['id']) rjson(Lang::get('PARAM_LOSE'));
		Db::query("update ".Config::get('database.prefix')."search set view=view+1 where id='{$_POST['id']}'");
		rjson(Lang::get('SUCCESS_DONE'),1);
	}
}
